package com.example.controller;

import com.example.common.Result;
import com.example.entity.AirQualitySensor;
import com.example.entity.InfraredSensor;
import com.example.entity.Params;
import com.example.service.AirQualitySensorService;
import com.example.service.InfraredSensorService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@ResponseBody
@RestController
@CrossOrigin
@RequestMapping("/INS")
public class InfraredSensorController {

    @Resource
    private InfraredSensorService infraredSensorService;


    @GetMapping("/findBySearchOfINS")
    public Result findBySearchOfINS(Params params){
        PageInfo<InfraredSensor> search = infraredSensorService.findBySearchOfINS(params);
        return Result.success(search);
    }

    @PostMapping("/addINS")
    public Result addINS(@RequestBody InfraredSensor infraredSensor){
       infraredSensorService.addINS(infraredSensor);
        return Result.success();
    }

    @DeleteMapping("/deleteINS/{id}")
    public Result deleteAQS(@PathVariable Long id){
        infraredSensorService.deleteINS(id);
        return Result.success();
    }
}
